package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * @author 韩先楚
 */
@RestController
@RequestMapping("/user/shop")
@Api(tags = "用户端-商铺状态管理")
@Slf4j
public class UserController {

    @Autowired
    private StringRedisTemplate redis;

    /**
     * 用户端查询商铺状态
     * @return Result
     * @author 韩先楚
     */
    @GetMapping("/status")
    @ApiOperation(value = "查询商铺状态", notes = "查询商铺状态")
    public Result<Integer> getShopStatus() {
        String status = redis.opsForValue().get("SHOP_STATUS");
        return Result.success(Integer.parseInt(status));
    }



}
